<?php
// +----------------------------------------------------------------------
// | 会员管理首页
// +----------------------------------------------------------------------
// | Copyright (c) 2015
// +----------------------------------------------------------------------
// | Author: baiping 125618036@qq.com http://www.webipcode.com
// +----------------------------------------------------------------------
// | 2015-6-26上午11:13:48
// +----------------------------------------------------------------------
?>
<?php $this->load->view('public/header');?>
<?php $this->load->view('public/head');?>
<div class="container-fluid">
	<div class="row">
		<?php $this->load->view('public/sideleft');?>
		<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main ">
			<!-- 内容区 -->
			<div class="main-title">
				<h3>
					<?php echo $meta_title ?>
				</h3>
			</div>
			<div class="con">
				<div class="cf">
					<div class="pull-left">
						<a href="<?php echo site_url('member/create')?>" class="btn btn-primary">新增</a> 
						<a href="<?php echo site_url('member/changesstatus/disable/?status_val=1')?>" class="btn btn-success ajax-post confirm" target-form="ids">启用</a> 
						<a href="<?php echo site_url('member/changesstatus/disable/?status_val=2')?>" class="btn btn-warning ajax-post confirm" target-form="ids">禁用</a> 
						<a href="<?php echo site_url('member/changesstatus/delete')?>" class="btn btn-danger ajax-post confirm" target-form="ids">删除</a>
					</div>
					<div class="pull-right search-form">
						<form action="<?php echo site_url('member/index')?>" method="post" name="search_form">
							<input class="search-input" type="text" placeholder="请输入用户名、邮箱、UID" name="search_name">
							<button type="submit" name="sub" class="btn btn-primary">
								<i class="glyphicon glyphicon-search"></i>
							</button>
						</form>
					</div>
				</div>
				<div class="clearfix"></div>
				<!-- 内容列表 -->
				<?php if ( $record_count > 0 ){?>
				<table class="table table-striped table-hover ">
					<thead>
						<tr>
							<th class="row-selected"><input class="checkbox check-all" type="checkbox"></th>
							<th>UID</th>
							<th>用户名</th>
							<th>邮箱</th>
							<th>注册时间</th>
							<th>登录次数</th>
							<th>最后登录时间</th>
							<th>最后登录IP</th>
							<th>状态</th>
							<th>操作</th>
						</tr>
					</thead>
					<?php foreach($list as $key => $val){?>
					<tr>
						<td>
						<?php if ( 1 == $val->uid ){?>
							<input class="ids row-selected" type="checkbox" value="<?php echo $val->uid; ?>" name="uid[]" disabled="disabled">
						<?php }else{?>
							<input class="ids row-selected" type="checkbox" value="<?php echo $val->uid; ?>" name="uid[]">
						<?php }?>	
						</td>
						<td><?php echo $val->uid;?></td>
						<td><small><?php echo $val->username;?></small></td>
						<td><small><?php echo $val->email;?></small></td>
						<td><?php echo time_format($val->reg_time);?></td>
						<td><?php echo $val->login_num;?></td>
						<td><?php echo time_format($val->last_login_time);?></td>
						<td><?php echo long2ip( $val->last_login_ip );?></td>
						<td>
							<?php if($val->status == 1){?>
							<span class="label label-success">正常</span>
							<?php }elseif($val->status == 2){?>
							<span class="label label-info">锁定</span>
							<?php }elseif ( $val->status == 3 ){?>
							<span class="label label-danger">删除</span>
							<?php }?></td>
						<td>
							<a href="<?php echo site_url('member/editpass/'.$val->uid)?>">修改密码</a>
							<?php if ( $val->status == 1 && $val->uid > 1 ){?>
							<a href="<?php echo site_url('member/changesstatus/disable/'.$val->uid.'/?status_val=2')?>" class="confirm ajax-get">禁用</a>
							<?php }elseif ($val->status == 2){?>
							<a href="<?php echo site_url('member/changesstatus/disable/'.$val->uid.'/?status_val=1')?>" class="confirm ajax-get">解锁</a>
							<?php }elseif ($val->status == 3){?>
							<a href="<?php echo site_url('member/changesstatus/disable/'.$val->uid.'/?status_val=1')?>" class="confirm ajax-get">恢复</a>
							<?php }?>
							<?php if( $val->uid != USER_ADMINISTRATOR ){?>
							<a href="<?php echo site_url('member/changesstatus/delete/'.$val->uid)?>" class="confirm ajax-get">删除</a>
							<?php }?>
						</td>
					</tr>
					<?php }?>
					<?php if( !empty( $pages ) ){?>
					<tr>
						<td colspan="7">
							<ul class="pagination">
								<?php echo $pages;?>
								<li><span>共<?php echo $record_count?>条记录</span></li>
							</ul>
						</td>
					</tr>
					<?php }?>
				</table>
				<?php }else{?>
				<div class="alert alert-warning" role="alert">哦亲！暂无数据</div>
				<?php }?>	
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
//左侧菜单高亮显示
highlight_subnav( '<?php echo site_url('menu/index')?>' );
</script>
<?php $this->load->view('public/footer');?>